﻿<%@ Page Language="C#" MasterPageFile="~/Game/Game.Master" AutoEventWireup="true"
    CodeBehind="Planets.aspx.cs" Inherits="smallDeimos.Game.Planets" Title="Small Deimos - planets" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
        DataSourceID="SqlDataSource1" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
        Width="700px" DataKeyNames="PlanetID,SystemID" 
    onrowdatabound="GridView1_RowDataBound" ShowFooter="True">
        <Columns>
            <asp:HyperLinkField DataNavigateUrlFields="SystemID,PlanetID" DataNavigateUrlFormatString="Planet.aspx?sId={0}&amp;pId={1}"
                DataTextField="Expr1" DataTextFormatString="{0}" HeaderText="Location">
                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="125px" />
            </asp:HyperLinkField>
            <asp:BoundField DataField="Farms" HeaderText="Farms" SortExpression="Farms" >
                <ItemStyle HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="Factories" HeaderText="Factories" 
                SortExpression="Factories" >
                <ItemStyle HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="Cybernets" HeaderText="Cybernets" 
                SortExpression="Cybernets" >
                <ItemStyle HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="Labs" HeaderText="Labs" SortExpression="Labs" >
                <ItemStyle HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="Starbase" HeaderText="Starbase" 
                SortExpression="Starbase" >
                <ItemStyle HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="PopulationLevel" HeaderText="Population" 
                SortExpression="PopulationLevel" >
                <ItemStyle HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="ProductionPoints" HeaderText="Production points" SortExpression="ProductionPoints"
                DataFormatString="{0:n2}" >
                <ItemStyle HorizontalAlign="Center" />
            </asp:BoundField>
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:smallDeimosConnectionString %>"
        SelectCommand="SELECT Planets.PlanetID, Planets.SystemID, Planets.OwnerID, Planets.FleetOwnerID, Planets.Farms, Planets.Factories, Planets.Cybernets, Planets.Labs, Planets.Starbase, Planets.PopulationLevel, Planets.PopToNextLevel, Planets.ProductionPoints, Systems.SystemName + ' #' + CAST(Planets.PlanetID AS nvarchar) AS Expr1 FROM Planets INNER JOIN Systems ON Planets.SystemID = Systems.SystemID WHERE (Planets.OwnerID = @Oid) ORDER BY Planets.PopulationLevel DESC, Planets.PopToNextLevel">
        <SelectParameters>
            <asp:CookieParameter CookieName="sd_id" Name="Oid" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Spend all" />
</asp:Content>
